//
//  YeeStoreHeaderView.m
//  YeeShopProject
//
//  Created by CoderYee on 2017/3/10.
//  Copyright © 2017年 CoderYee. All rights reserved.
//

#import "YeeStoreHeaderView.h"

@implementation YeeStoreHeaderView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self=[super initWithFrame:frame])
    {
       
        [self addOwnView];
        
    }
    return self;
}
-(void)addOwnView
{
    _coverImageView=[[UIImageView alloc] init];
    _coverImageView.contentMode=UIViewContentModeScaleAspectFill;
    _coverImageView.clipsToBounds=YES;
    [_coverImageView sd_setImageWithURL:[NSURL URLWithString:@"http://upload-images.jianshu.io/upload_images/568470-131e48b91b4119be.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240"] placeholderImage:defaultPImage];
    [self addSubview:_coverImageView];
    [_coverImageView mas_makeConstraints:^(MASConstraintMaker *make)
    {
        make.edges.equalTo(self).insets(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    UIView *coverView=[[UIView alloc] init];
    [coverView setBackgroundColor:kBlackColor];
    coverView.alpha=0.35;
    [self addSubview:coverView];
    [coverView mas_makeConstraints:^(MASConstraintMaker *make)
     {
         make.edges.equalTo(self).insets(UIEdgeInsetsMake(0, 0, 0, 0));
     }];
    _iconView=[[UIImageView alloc] init];
    _iconView.contentMode=UIViewContentModeScaleAspectFill;
    _iconView.clipsToBounds=YES;
    [_iconView sd_setImageWithURL:[NSURL URLWithString:@"http://upload-images.jianshu.io/upload_images/2542851-33b32dd4d4a5f037.jpeg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240"] placeholderImage:defaultPImage];
    [self addSubview:_iconView];
    [_iconView mas_makeConstraints:^(MASConstraintMaker *make)
     {
         make.bottom.equalTo(self);
         make.left.equalTo(self).with.offset(15);
         make.width.height.mas_equalTo(60);
     }];
    
    _storeLable=[[UILabel alloc]init];
    _storeLable.textColor=kWhiteColor;
    _storeLable.font=[UIFont Y_systemFontOfSize:16];
    _storeLable.text=@"森马国际旗舰店";
    [self addSubview:_storeLable];
    [_storeLable mas_makeConstraints:^(MASConstraintMaker *make)
    {
        make.centerY.equalTo(_iconView.mas_centerY);
        make.left.equalTo(_iconView.mas_right).with.offset(15);
        make.height.mas_equalTo(21);
    }];
    
    _collectionButton=[UIButton buttonWithType:UIButtonTypeCustom];
    [_collectionButton setTitle:@"收藏" forState:UIControlStateNormal];
    _collectionButton .titleLabel.font=[UIFont Y_systemFontOfSize:14];
    [_collectionButton setBackgroundColor:kNavBarThemeColor];
    _collectionButton.layer.masksToBounds=YES;
    _collectionButton.layer.cornerRadius=5.0f;
//    _collectionButton.layer.borderWidth=0.3;
//    _collectionButton.layer.borderColor=kNavBarThemeColor.CGColor;
    [self addSubview:_collectionButton];
    [_collectionButton mas_makeConstraints:^(MASConstraintMaker *make)
    {
        make.centerY.equalTo(_iconView.mas_centerY);
        make.right.equalTo(self).with.offset(-15);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(60);
    }];
    
    
}

@end
